package com.zw.yzk.kabu.mapper;

import com.zw.yzk.kabu.data.network.entity.SearchExhibitionEntity;
import com.zw.yzk.kabu.model.SearchExhibitionModel;

import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

/**
 * Created by zhanwei on 2017/5/14.
 */

public class SearchExhibitionMapper {

    @Inject
    public SearchExhibitionMapper() {

    }

    public List<SearchExhibitionModel> transfer(SearchExhibitionEntity entity) {
        List<SearchExhibitionModel> result = new ArrayList<>();
        if (entity.result == null || entity.result.exhibitionList == null) {
            return result;
        }
        for (SearchExhibitionEntity.Exhibition exhibition : entity.result.exhibitionList) {
            SearchExhibitionModel model = new SearchExhibitionModel();
            model.setId(exhibition.id);
            model.setImage(exhibition.img);
            model.setTitle(exhibition.name);

            result.add(model);
        }
        return result;
    }
}
